<?php 
$show_validator = true;
include TMPL_PATH.'public/header.phtml';
?>
<script type="text/javascript">
<!--
$(function(){
	$.formValidator.initConfig({autotip:true,formid:"myform",onerror:function(msg){}});
	$("#username").formValidator({onshow:"请输入用户名",onfocus:"用户名应该为2-20位之间"}).inputValidator({min:2,max:20,onerror:"用户名应该为2-20位之间"}).ajaxValidator({
	    type : "get",
		url : "<?php echo U('manage/public_checkname_ajx');?>",
		data :"",
		datatype : "html",
		async:'false',
		success : function(data){	
            if( data == "1" )
			{
                return true;
			}
            else
			{
                return false;
			}
		},
		buttons: $("#dosubmit"),
		onerror : "用户已存在。",
		onwait : "请稍候..."
	});
	$("#password").formValidator({onshow:"请输入密码",onfocus:"密码应该为6-20位之间"}).inputValidator({min:6,max:20,onerror:"密码应该为6-20位之间"});
	$("#pwdconfirm").formValidator({onshow:"请输入确认密码",onfocus:"请输入两次密码不同。",oncorrect:"密码输入一致"}).compareValidator({desid:"password",operateor:"=",onerror:"请输入两次密码不同。"});
	$("#email").formValidator({onshow:"请输入E-mail",onfocus:"E-mail格式错误",oncorrect:"E-mail格式正确"}).regexValidator({regexp:"email",datatype:"enum",onerror:"E-mail格式错误"});
})
//-->
</script>

<div class="pad_10">
<div class="common-form">
<form name="myform" action="<?php echo U('manage/add');?>" method="post" id="myform">
<table width="100%" class="table_form contentWrap">
<tr>
<td width="80">用户名</td> 
<td><input type="text" name="info[username]"  class="input-text" id="username"/></td>
</tr>
<tr>
<td>密码</td> 
<td><input type="password" name="info[password]" id="password" class="input-text"/></td>
</tr>
<tr>
<td>确认密码</td> 
<td><input type="password" name="info[pwdconfirm]" id="pwdconfirm" class="input-text"/></td>
</tr>
<tr>
<td>E-mail</td>
<td>
<input type="text" name="info[email]" value="" class="input-text" id="email" size="30"/>
</td>
</tr>
<tr>
<td>真实姓名</td>
<td>
<input type="text" name="info[realname]" value="" class="input-text" id="realname"/>
</td>
</tr>
<tr>
<td>状态</td>
<td>
<input name="info[display]" value="1" type="radio" checked/> 开启    
<input name="info[display]" value="0"  type="radio" /> 禁用

</td>
</tr>
<tr>
<td>所属角色</td>
<td>
<select name="info[roleid]">
<?php 
if(isset($roles) && $roles){
	foreach($roles as $role){
?>
<option value="<?php echo $role['id']?>"><?php echo $role['rolename']?></option>
<?php 
}	}
?>
</select>
</td>
</tr>
</table>

    <div class="bk15"></div>
    <input name="dosubmit" type="submit" value="提交" class="dialog" id="dosubmit" />
</form>
</div>
</div>
</body>
</html>